// 引入axios封装文件
import request, { mockIP, backendIP } from "@/utils/request"
import { replacePath } from "@/utils/index"

var IP = "";
var mockIPTemp = mockIP;
var backendIPTemp = backendIP;
mockIPTemp = backendIPTemp;//切换全局后台IP地址
// backendIPTemp = mockIPTemp;//切换全局模拟IP地址


//--------------------首页--------------------
//物资近期出入库记录
export function kanbanGetStockInAndOutRecord(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getStockInAndOutRecord",
    method: "post",
    data: data
  })
}

//安全工器具近期出入库记录
export function kanbanGetToolsStockInAndOutRecord(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getToolsStockInAndOutRecord",
    method: "post",
    data: data
  })
}

//物资库存预警
export function kanbanGeInventoryWarning(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/geInventoryWarning",
    method: "post",
    data: data
  })
}

//物资盘点
export function kanbanGetInventory(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getInventory",
    method: "post",
    data: data
  })
}

//获取用户数据
export function kanbanGetUserData(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getUserData",
    method: "get",
    params: data
  })
}

//本年度 按月计算出入库数量
export function kanbanGetCountsMonth(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getCountsMonth",
    method: "get",
    params: data
  })
}


//--------------------出库记录--------------------
//领用记录
export function kanbanGetOutRecord(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getOutRecord",
    method: "post",
    data: data
  })
}
//领用记录详情列表
export function kanbanGetOutDetailRecord(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getOutDetailRecord",
    method: "post",
    data: data
  })
}


//--------------------退库记录--------------------
//归还记录
export function kanbanGetInRecord(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getInRecord",
    method: "post",
    data: data
  })
}
//归还记录详情列表
export function kanbanGetInDetailRecord(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getInDetailRecord",
    method: "post",
    data: data
  })
}


//--------------------盘点记录--------------------
//获取盘点记录
export function kanbanGetInventoryRecord(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getInventoryRecord",
    method: "post",
    data: data
  })
}
//获取盘点详情记录
export function kanbanGetInventoryDetail(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getInventoryDetail",
    method: "post",
    data: data
  })
}

//开始盘点
export function kanbanManualInventoryStart(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/manualInventory/start",
    method: "get",
    params: data
  })
}

//结束盘点
export function kanbanManualInventoryStop(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/manualInventory/stop",
    method: "get",
    params: data
  })
}

//--------------------工作票记录--------------------
//获取工作票记录
export function kanbanGetWorkOrderList(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getWorkOrderList",
    method: "post",
    data: data
  })
}
//获取工作票详情记录
export function kanbanGetWorkOrderDetail(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getWorkOrderDetail",
    method: "post",
    data: data
  })
}
//工作票识别后提交
export function kanbanPreDelivery(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/preDelivery",
    method: "post",
    data: data
  })
}
//根据票据名称等信息，生成预出库信息并返回
export function kanbanSubmitDelivery(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/submitDelivery",
    method: "post",
    data: data
  })
}
//工器具查询
export function kanbangetToolsStock(data) {
  IP = true ? mockIPTemp : backendIPTemp;
  return request({
    url: "/kanban/getToolsStock",
    method: "post",
    params: data
  })
}